home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / EDITORS / LEDIT / !lEdit / !Help < prev    next >
Text File  |  1995-04-19  |  31KB  |  965 lines

  1.  
  2.  
  3.                        lEdit Version 0.1 [35] 
  4.                        ----------------------
  5.  
  6.  
  7.                       ** (c) 1995 Urs Bisang **
  8.                       ** all rights reserved **
  9.                      
  10.  
  11.         This version of lEdit is FREEWARE!
  12.         Permission is granted for unrestricted non-commercial use!  
  13.  
  14.         If you find this program useful or if you have comments, requests
  15.         or bug reports please send a mail to:
  16.  
  17.         bisang@solid.phys.ethz.ch
  18.                      
  19.                      
  20. Purpose: (Lisp) Text Editor
  21. --------
  22.  
  23. Introduction:
  24. -------------
  25.  
  26. lEdit is a fully programmable and customizable text editor,
  27. that has special support for Lisp programming. It supports
  28. automatic identing of the source code and the matching of parentheses.
  29. This features can be disabled and then lEdit behaves like a
  30. simple text editor comparable to !Edit. The main difference to other 
  31. editors is that lEdit has a builtin Lisp interpreter. Actually lEdit 
  32. has been programmed in Lisp itself, so you can customize lEdit in 
  33. every way simply by changing the lisp source code and without any
  34. recompilation of the application. In this way lEdit is similar to Emacs 
  35. (the famous editor in the Unix world). Of course lEdit is much simpler 
  36. and less powerful than Emacs, but it is also much smaller!  
  37.    
  38.  
  39. Description:
  40. ------------
  41.  
  42. The handling of lEdit is very similar to !Edit. So mainly the
  43. differences to !Edit will be described. For further details on
  44. !Edit see for example the 'RISC OS3 Applications Guide'.
  45.  
  46.  
  47. Short description of the menu entries:
  48.  
  49. Misc    
  50. ----   
  51. Info : tells you about lEdit
  52. New View : opens additional window on the same text
  53. Print : sends the document to the printer
  54. Undo : allows you to step backwards through the most recent changes
  55.        you have made to the text
  56. Redo : allows you to remake the changes you reversed with Undo
  57.  
  58. Save
  59. ----
  60. Save: save the file in the current window
  61.  
  62. Select
  63. ------
  64. Save : saves the current text selection
  65. Print : prints the current text selection
  66. Copy : copies current text selection (to the cursor position)
  67. Move : moves current text selection (to the cursor position)
  68. Delete : deletes current text selection
  69. Clear : clears (unselects) current text selection
  70.  
  71. Edit
  72. ----
  73. Find       : allows you to search for a string in your file
  74.              the find utility is rather simple and no wildcarded
  75.              search strings are allowed. but escape characters such
  76.              as '\n', '\r', etc  and \xhh (hh : hex number)
  77.              are allowed to search for non printable characters.
  78.              \\ is used for the backslash itself
  79. Goto       : allows you to move to a specific line in your file
  80. Replace    : allows you to replace a string or all matching strings
  81.              through another string in your file. the replace facility
  82.              has been separated from the find facility in order to 
  83.              prevent replacing accidently
  84. Ident      : ident line, that contains the cursor according to the rules
  85.              of lisp identing
  86. RecIdent   : ident lines recursively starting from the line that
  87.              contains the cursor
  88. Match ()   : shows the matching opening parenthesis if the cursor is
  89.              right behind a closing parenthesis. if there is no matching
  90.              parenthesis or the cursor is not behind a closing 
  91.              parenthesis nothing happens. in this context parenthesis
  92.              means only 'real' parentheses that belong to a lisp 
  93.              construct (list) and do not stand inside a string, 
  94.              comment or character constant
  95. Next (     : moves the cursor to the next opening 'real' parenthesis.
  96. Previous ( : moves to previous (matching!) opening 'real' parenthesis
  97. Next )     : moves to next (matching!) closing 'real' parenthesis
  98. Previous ) : moves to previous closing 'real' parenthesis
  99.  
  100. Options
  101. -------
  102. Ident : enable/disable automatic line identing after typing return
  103. Match : enable/disable automatic highlighting of matching parentheses
  104.         after typing a closing parentheses
  105. Amimate : enable/disable animation of cursor on identing
  106.  
  107.             
  108. Important keystroke and keystroke equivalents:
  109.  
  110.  
  111. Function keys:
  112. --------------    
  113.  
  114. F3 : save file
  115. F4 : find string
  116. F5 : goto line
  117. F6 : replace string
  118. F8 : undo
  119. F9 : redo
  120.  
  121. Control keys:
  122. -------------
  123.  
  124. Ctrl-C : copies current text selection (to the cursor position)
  125. Ctrl-V : moves current text selection (to the cursor position)
  126. Ctrl-X : deletes current text selection
  127. Ctrl-Z : clears (unselects) current text selection
  128. Ctrl-R : ident lines recursively
  129. Ctrl-M : show matching 'real' parenthesis
  130. Ctrl-A : moves the cursor to the next opening 'real' parenthesis.
  131. Ctrl-S : moves to previous (matching!) opening 'real' parenthesis
  132. Ctrl-D : moves to next (matching!) closing 'real' parenthesis
  133. Ctrl-F : moves to previous closing 'real' parenthesis
  134.  
  135. Misc keys:
  136. ----------
  137.  
  138. TAB       : ident line, that contains the cursor according to the rules
  139.             of lisp identing
  140. SHIFT-TAB : similar to TAB but differing slightly in the rules 
  141.             for identation (has fixed identation under symbols
  142.             as default)
  143. HOME      : moves cursor to beginning of the file
  144. DELETE    : deletes character to the left of cursor
  145. BACKSPACE : deletes character to the left of cursor
  146. COPY      : deletes character to the right of cursor
  147. PAGE-UP   : scroll up one window
  148. PAGE-DOWN : scroll down one window
  149. ARROW-UP  : moves cursor one line up
  150. ARROW-DOWN : moves cursor one line down
  151. ARROW-LEFT : moves cursor to the left
  152. ARROW-RIGHT : moves cursor to the right
  153. CTRL-ARROW-UP : moves cursor to the beginning of the file
  154. CTRL-ARROW-DOWN : moves cursor to the end of the file
  155. CTRL-ARROW-LEFT : moves the cursor to the first non blank charakter
  156.                   of the line
  157. CTRL-ARROW-RIGHT: moves cursor to the end of line
  158.  
  159.  
  160. Customising lEdit:
  161. ------------------
  162.  
  163. The fonts and the colors used for lEdit can be set using the
  164. environment variable lEdit$Options. The options are the same as
  165. for !Edit (see the 'RISC OS3 Applications Guide'). Apart from
  166. that you can change lEdit in every way (menu layout, keyboard shortcuts,
  167. default settings, new functionality, etc.) by simply patching the 
  168. source code, contained in the 'l' directory within the lEdit
  169. application directory. This flexibilty is the main advantage of lEdit 
  170. over other editors, due to fact that lEdit is fully programable with its
  171. builtin Lisp interpreter. You could even write a 'completely new editor'
  172. or additional modes with support for other programming languages like
  173. C, C++, Pascal, etc. 
  174.  
  175. There are some special forms like define, defun, lambda, let, etc.,
  176. which have special identation rules. If you have additional forms,
  177. that should be idented in a special way, you can do this by 
  178. extending the function 'txt-lisp-ident-hook' located in the file
  179. lispmode. Extensions should be straightforward. 
  180.  
  181.  
  182.  
  183. The Lisp Interpreter:
  184. ---------------------
  185.  
  186. The builtin Lisp interpreter is very simple and supports
  187. only two data types: strings and cons cells. Integer and float numbers
  188. are represented as strings, therefore the interpreter is rather slow.
  189. The idea is to use the interpreter as an extension language and
  190. to implement computational intensive task as additional primitives in C.
  191. The naming conventions for the primitives are similar to Scheme.
  192. But it ist not Scheme! The interpreter is dynamically scoped, and
  193. no closures and no continuations are supported. The interpreter is not
  194. tail-recursive! There are additional types like hash tables or opaque 
  195. types (menus, text buffers, etc.) which are not first class and 'exist' 
  196. only bound to a symbol. If you want to pass an object of such a type to a 
  197. function or primitive, you have to pass the symbol which this object 
  198. is bound to. If you evaluate a symbol which is bound to an object of
  199. such an non first class type, it evaluates not to its value, but rather to 
  200. its own name. I call this form of evaluation 'name evaluation' and 
  201. the corresponding non first class types name evaluation types. 
  202. The introduction of this rather strange name evaluation is necessary, as
  203. the interpreter supports only strings and cons cells. Functions that
  204. expect name evaluation types first evaluate their argument in a standard
  205. way to obtain the symbol and then access the name evaluation
  206. type object bound to this symbol in a non-standard way. Certain
  207. primitives have Dylan style keyword optional parameters
  208. (for example foo: <expr>). User-defined functions can have only 
  209. 'normal' optional parameters, which can be declared with the 
  210. keyword ':rest' just before the last parameter in the parameter list.
  211. All additional values will then be put in a list and bound to 
  212. this last parameter called rest parameter.
  213.                      
  214.  
  215.  
  216. Command line options:
  217. ---------------------
  218.  
  219. The interpreter application is called 'wtk' and has the following
  220. command line syntax:
  221.  
  222. wtk [-options] infile
  223.  
  224. Options:
  225.  
  226. -i  : starts interactive session reading input from <stdin> and output
  227.       going to <stdout>
  228.  
  229. -verbose : enable verbose mode of the Lisp interpreter
  230.  
  231. -throwback : uses the DDE throwback mechanism to report errors.
  232.              
  233. -postmortem : enters the builtin debugger when a fatal error has
  234.               occured instead of leaving the interpreter 
  235.  
  236. -args : Command line arguments for the interpreter. The rest of 
  237.         the command line args are passed to the interpreter in 
  238.         a list which is bound to the symbol *cmdline-args* 
  239.  
  240. -htsize : set the system hash table size (default: 1800)
  241.  
  242. -lstsize : set the local parameter stack size (default: 500)
  243.   
  244.                                
  245. The interpreter uses the path WTK: (set with wtk$path) to find its file
  246. when loading files with the load primitive.
  247.  
  248. Initialisation of the interpreter and the automatic loading of
  249. additional files on startup is handled with the 'wtk_init', which must
  250. be present, but may be empty. 
  251.  
  252. It is possible to register a finalization procedure, which is
  253. called before the interpreter terminates in a normal way (not
  254. through an error or explicit call to exit). 
  255. An expression can be bound to the symbol *finalization* which
  256. gets evaluated right before the interpreter exits.
  257.  
  258.  
  259. Brief summary of the builtin primitives:
  260. ----------------------------------------
  261.  
  262. The following notations are used for the summary:
  263.  
  264. <..> : required expression which evaluates to given type
  265. [..] : optional expression which evaluates to given type
  266. expr : arbitrary lisp expression
  267. char : character constant like #\A, #\\n (newline) etc.
  268. string : "A lisp string"
  269. int    : integer number, like 0, -501, #xfff (hex), 
  270.          #o15 (octal), or char constant #\A, #\\n (newline) etc. 
  271. float  : floating point number like 1.034, 5.76e-5, etc.
  272. number : float number or integer number
  273. symbol : any valid lisp symbol
  274. hashtable : hash table (opaque type!, name evaluation!)
  275. txt    : text edit buffer (opaque type!, name evaluation!)
  276. menu   : menu struct      (opaque type!, name evaluation!)
  277. dbox   : dbox struct      (opaque type!, name evaluation!)
  278. expr-sequence : a sequence of valid lisp expressions
  279.  
  280.  
  281. ;;; kernel primitives
  282.  
  283. ;; loads a lisp source file and evaluates its content.
  284. ;; returns file name of loaded file
  285. (load <string>)                    
  286.  
  287. ;; like load, but a file is only loaded once.
  288. ;; returns file name of loaded file or nil if file is already loaded
  289. (use <string>)
  290.  
  291. ;; enters the builtin string and prints and prints optionally
  292. ;; a message. returns nil
  293. (debug [string])
  294.  
  295. ;; standard lisp primitive
  296. (quote <expr>)
  297.  
  298. ;; standard lisp primitive
  299. (quasiquote <expr>)       
  300.              
  301. ;; exits the interpreter returning optionally an error code
  302. (exit [int])
  303.  
  304. ;; evaluates the expression in the current environment
  305. (eval <expr>)
  306.  
  307. ;; binds a new value to symbol (assignment)
  308. ;; returns new value
  309. (set! symbol <expr>)
  310.  
  311. ;; like set! but first argument is also evaluated 
  312. (set-eval! <symbol> <expr>)    
  313.  
  314. ;; evaluates each expression in the sequence in turn
  315. ;; returns the value of the last expression
  316. (begin <expr-sequence>)                    
  317.  
  318. ;; evaluates the expression sequence as long as condition
  319. ;; is true. returns the value of the last expression evaluated 
  320. (while <condition-expr> <expr-sequence>)
  321.  
  322. ;; creates and initializes new local symbol for the 
  323. ;; extent of the let command
  324. ;; the semantic of let is similar to the semantic of let*  
  325. ;; in scheme                                   
  326. (let ((symbol<1> <expr>) ... (symbol<n> <expr>))
  327.   <expression-sequence>)
  328.                       
  329. ;; prints expressions to stdout
  330. (print <expr-sequence>)
  331.  
  332. ;; defines a new toplevel symbol binding 
  333. (define symbol <expr>)                  
  334.  
  335. ;; defines a new toplevel function
  336. (define (symbol <parameter-list>) <expr-list>)
  337.  
  338. ;; define an anonymous function
  339. (lambda (<parameter-list>) <expr-sequence>)
  340.  
  341. ;; defines a macro. a macro is like a function but gets 
  342. ;; its arguments unevaluated
  343. (define-syntax symbol (<parameter-list>) <expr-sequence>)
  344.                                  
  345. ;;; list manipulation primitives 
  346.                                  
  347. (car <list>)               ; car of list
  348. (cdr <list>)               ; cdr of list
  349. (cons <expr> <list>)       ; cons expr at head of list
  350.  
  351. ;; appends lists together. the last argument can be a
  352. ;; list or any valid expression
  353. (append <list> <list> ... <list/expr>)  
  354.            
  355. (list <expr-sequence>)     ; build list from expression sequence
  356.                                          
  357. ;; get the element in a list at position <integer>
  358. (list-ref <list> <integer>)          
  359.  
  360. ;; insert element in list after position <integer>
  361. ;; destructive operation
  362. (list-insert! <list> <integer> <expr>) 
  363.   
  364. ;; returns the length of a list or symbol or string
  365. (length <expr>) 
  366.            
  367. ;; standard lisp primitive
  368. (if <cond-expr> <then-expr> [else-expr])
  369.  
  370. ;; standard lisp primitive
  371. ;; corresponds to an 'if-then-elsif-else' construct in
  372. ;; other procedural languages
  373. (cond (<cond-expr> <expr-sequence>) ....
  374.       [(else <expr-sequence>)])
  375.  
  376. ;; logical operators
  377. (not <expr>)              ; logical not
  378. (and <expr> ... <expr>)   ; logical and
  379. (or <expr> ... <expr>)    ; logical or
  380.  
  381. ;; bitwise and operation
  382. (bit-and <integer> ... <integer>)
  383.  
  384. ;; bitwise or operation
  385. (bit-or <integer> ... <integer>)
  386.  
  387. ;; arithmetic operations
  388. (+ <number> ... <number>) ; addition
  389. (* <number> ... <number>) ; multiplication
  390. (- <number> ... <number>) ; subtraction
  391. (/ <number> ... <number>) ; division
  392. (div <number> <number>)   ; integer divison
  393. (mod <number> <number>)   ; remainder of division
  394.   
  395.  
  396. ;; numerical comparisons
  397. (=  <number> <number>) ; equal
  398. (\= <number> <number>) ; not equal
  399. (>  <number> <number>) ; greater
  400. (>= <number> <number>) ; greater equal 
  401. (<  <number> <number>) ; less 
  402. (<= <number> <number>) ; less equal
  403.  
  404. ;; returns #t if the two expressions are equal otherwise #f
  405. (equal? <expr> <expr>)
  406.  
  407. ;; various predicates (return #t or #f)
  408. (symbol? <expr>)      ; is it a symbol ?
  409. (string? <expr>)      ; is it a string ?
  410. (char? <expr>)        ; is it a character constant ?
  411. (list? <expr>)        ; is it a list ?
  412. (null? <expr>)        ; is it nil (empty list) ?
  413. (integer? <expr>)     ; is it an integer number
  414. (float? <expr>)       ; is it a float number ?
  415. (number? <expr>)      ; is it a number (float/integer) ?
  416. (bound? <expr>)       ; is the symbol bound to a value ?
  417. (function? <expr>)    ; is it a function
  418. (hashtable? <expr>)   ; is it a hashtable
  419. (opaque? <expr>)      ; is it an object of opaque type ?
  420.                          
  421. ;; transforms string to a symbol
  422. (string->symbol <string>)
  423.  
  424. ;; transforms symbol to a string
  425. (symbol->string <symbol>)
  426.  
  427. ;; gets character at position <integer> in a string
  428. (string-ref <string> <integer>)
  429.  
  430. ;; gets character at position <integer> in a symbol
  431. (symbol-ref <symbol> <integer>)
  432.  
  433. ;; sets the character in string at position <integer> to <char>
  434. (string-set! <string> <integer> <char>)
  435.  
  436. ;; sets the character in symbol at position <integer> to <char>
  437. (symbol-set! <symbol> <integer> <char>)
  438.  
  439. ;; concatenates expressions to a string
  440. (string-concat <expr-sequence>)       
  441.  
  442. ;; concatenates expressions to symbol
  443. (symbol-concat <expr-sequence>)
  444.  
  445. ;; gets 'subsymbol' from <integer1> to <integer2>
  446. (subsymbol <symbol> <integer1> <integer2>)
  447.  
  448. ;; gets 'substring' from <integer1> to <integer2>
  449. (substring <symbol> <integer1> <integer2>)
  450.                          
  451. ;; transforms character to a symbol
  452. (character->symbol <char>)
  453.  
  454. ;; set property of a symbol
  455. (getp <symbol> <symbol>)       
  456.  
  457. ;; get property of a symbol
  458. (setp! <symbol> <symbol> <expr>)
  459.  
  460. ;;; hash table primitives
  461.  
  462. ;; lookup value of <symbol> in hashtable 
  463. (hash-ref <hashtable> <symbol>) 
  464.  
  465. ;; set value of <sybmol> in hashtable
  466. (hash-set! <hashtable> <symbol> <expr>)                    
  467.  
  468. ;; create hash table of size <integer> and bind it to symbol
  469. ;; (name evaluation type!)
  470. (make-hashtable symbol <integer>)
  471.  
  472. ;;; error messages  (supports throwback)                  
  473. (sfatal <expr> <expr-sequence>)    ; fatal error
  474. (serror <expr> <expr-sequence>)    ; non fatal error
  475. (swarning <expr> <expr-sequence>)  ; warning message
  476.                
  477. ;; wait <float> seconds
  478. (delay <float>)      
  479.                         
  480. ;; executes external command line command (OSCLI)
  481. (system  <expr-sequence>)
  482.  
  483. ;;; additional primitives supporting WIMP programming
  484. ;;; most of these primitives are directly from the RISCOS_LIB
  485. ;;; of Acorn Desktop C V4. For details about these primitives
  486. ;;; see the Acorn Desktop C V4 reference manual.
  487.  
  488.  
  489. ;; returns version of wtk
  490. (wtk-version)            
  491.  
  492. ;; initializes wtk. wimpt_init(<string>), res_init(<string>), 
  493. ;; respr_init(), template_init() and dbox_init are called
  494. (wtk-init <string>)
  495.  
  496. ;; installs a handler for the dataopen broadcast message
  497. (wtk-dataopen-handler <expr>)
  498.  
  499. ;; installs a handler for the prequit broadcast message
  500. ;; handler should return #t or #f
  501. (wtk-prequit-handler <expr>)
  502.  
  503. (wimpt-init <string>)   ; init wimp
  504. (res-init <string>)     ; init resources      
  505. (resspr-init)           ; init sprite resources 
  506. (resspr-area)           ; return actual sprite area
  507. (template-init)         ; init templates
  508. (wimpt-wimpversion <integer>) ; set wimp version
  509.  
  510. ;; display wimp error dialog box
  511. ;; <integer> should be 1 (fatal) or 0 (non fatal) error 
  512. (werr <integer> <expr-sequence>)
  513.  
  514. ;; set new baricon sprite
  515. (baricon-newsprite <string>)
  516.  
  517. ;; set new baricon menu with a new handler and an optional handle
  518. ;; <symbol> is the name of the handler function  
  519. (baricon-newmenu <menu> <symbol> [handle])
  520.  
  521. ;; put an icon on the icon bar and set handlers, menus, etc.
  522. (baricon <string>
  523.    [:left]                  ; icon on left side of icon bar
  524.    [clickproc: <expr>]      ; action for click on baricon
  525.    [loadproc:  <expr>]      ; action for drag on baricon
  526.    [text: <string>]         ; baricon with text
  527.    [spritearea: <integer>]  ; spritearea for baricon
  528.    [menu: <menu> menuhandler: <expr> menu-handle: <expr>]) ; baricon menu
  529.  
  530. ;; shift pressed? 
  531. (akbd-pollsh)
  532.  
  533. ;; ctrl pressed?
  534. (akbd-pollctl)
  535.  
  536. ;; dialog box primitives
  537. (dbox-new <string>)        ; create dbox
  538. (dbox-dispose <dbox>)      ; destroy dbox
  539. (dbox-show <dbox>)         ; display dbox
  540. (dbox-showstatic <dbox>)   ; display dbox (static)
  541. (dbox-hide <dbox>)         ; close dbox 
  542.  
  543. ;; set textfield #<integer> of dbox to value <string> 
  544. (dbox-setfield <dbox> <integer> <string>)
  545.  
  546. ;; get value of textfield #<integer1>  (buffer size: <integer2>)        
  547. (dbox-getfield <dbox> <integer1> <integer2>)
  548.  
  549. ;; set numeric value <integer1> of a dbox field #<integer1>
  550. (dbox-setnumeric <dbox> <integer1> <integer2>)
  551.  
  552. ;; get numeric value of dbox field #<integer>
  553. (dbox-getnumeric <dbox> <integer>)
  554.                                  
  555. ;; fade dox field #<integer>
  556. (dbox-fadefield <dbox> <integer>)
  557.  
  558. ;; unfade dbox field #<integer>
  559. (dbox-unfadefield <dbox> <integer>)
  560.  
  561. ;; display dbox as long as necessary
  562. (dbox-fillin <dbox>)
  563.  
  564. ;; similar to dbox-fillin
  565. (dbox-fillin-fixedcaret <dbox>)
  566.  
  567. ;; popup dbox with name <string1> and message <string2>
  568. ;; and return activated field number
  569. (dbox-popup <string1> <string2>)
  570.  
  571. ;; returns whether dbox should persist 
  572. (dbox-persist)
  573.  
  574. ;; return window handle of a dbox
  575. (dbox-syshandle <dbox>)
  576.  
  577. ;; init dboxes
  578. (dbox-init)
  579.  
  580. ;; displays a yes/no dbox with question <string>
  581. (dbox-query <string>)
  582.  
  583. ;; process an event
  584. (event-process)
  585.  
  586. ;; are there any active windows ready for event processing ?
  587. (event-anywindows)
  588.  
  589. ;; attach menu to given window 
  590. ;; window handle: <integer>, menu handler: <expr1>, menu handle: <expr2>
  591. (event-attachmenu <integer> <menu> <expr1> <expr2>)
  592.  
  593. ;; attach menu maker to given window
  594. ;; window handle: <integer>, menu handler: <expr1> menu handle: <expr2>
  595. (event-attachmenumaker <integer> <expr1> <expr2>)
  596.  
  597. ;; clear current menu tree
  598. (event-clear-current-menu)
  599.  
  600. ;; is the menu going to be recreated ?
  601. (event-is-menu-being-recreated)
  602.  
  603. ;; create new menu 
  604. ;; menu title: <string1>, menu description: <string2>
  605. (menu-new <string1> <string2>)
  606.  
  607.  
  608. ;; change or extend existing menu
  609. (menu-change <menu>
  610.   [extend: <string>]    ; extend menu
  611.   [submenu: <menu> entry: <integer>]  ; attach submenu
  612.   ;; tick (<integer1>) or fade (<integer2>) menu entry
  613.   [setflags: <integer1> <integer2> entry: <integer>]
  614.   [make-sprite: <string> entry: <integer>] ; use sprite for menu entry
  615.   ;; make a menu entry writable (use symbol as buffer, distructiv!)
  616.   [make-writeable: <symbol> <string> entry: <integer>]) 
  617.  
  618. ;; destroys menu (<integer> != 0, recursive dispose of submenus) 
  619. (menu-dispose <menu> <integer>)
  620.  
  621. ;; main event loop
  622. (main-event-loop)
  623.  
  624. ;; init flex memory manager
  625. (flex-init)
  626.  
  627. ;;; text buffer primitives
  628.  
  629. ;; create a new text buffer
  630. ;; [integer] undo buffer size (=0 no undo buffer)
  631. (txt-new <string> [integer])                     
  632.  
  633. ;; display text buffer in a window
  634. (txt-show <txt>)
  635.  
  636. ;; close windows open windows of the text buffer
  637. (txt-hide <txt>)
  638.  
  639. ;; set window title of text buffer
  640. (txt-settitle <txt> <string>)
  641.  
  642. ;; deletes a text buffer
  643. (txt-dispose <txt>)
  644.  
  645. ;; internal size of text buffer
  646. (txt-bufsize <txt>)            
  647.  
  648. ;; set internal size of text buffer
  649. (txt-setbufsize <txt> <integer>)
  650.  
  651. ;; get the char options of the text buffer
  652. (txt-charoptions <txt>)
  653.  
  654. ;; set the char options of the text buffer     
  655. ;; mask: <integer1>, flags: <integer2>
  656. (txt-setcharoptions <txt> <integer1> <integer2>)
  657.  
  658. ;; returns position of cursor
  659. (txt-dot <txt>)
  660.  
  661. ;; returns maximum value the cursor can take
  662. (txt-size <txt>)                                  
  663.  
  664. ;; set cursor at position <integer> in text buffer
  665. (txt-setdot <txt> <integer>)
  666.  
  667. ;; move cursor by <integer> chars
  668. (txt-movedot <txt> <integer>)
  669.                             
  670. ;; insert char to the right of the cursor
  671. (txt-insertchar <txt> <char>)
  672.  
  673. ;; insert string to the right of the cursor in the text buffer
  674. (txt-insertstring <txt> <string>)
  675.  
  676. ;; delete #<integer> characters to the right of the cursor 
  677. (txt-delete <txt> <integer>)
  678.  
  679. ;; get character at cursor position
  680. (txt-charatdot <txt>)
  681.  
  682. ;; get character at position #<integer> 
  683. (txt-charat <txt> <integer>)
  684.  
  685. ;; scroll text window in vertical direction
  686. ;; by #<integer1> lines (<integer2>: cursor fixed)
  687. (txt-movevertical <txt> <integer1> <integer2>)
  688.  
  689. ;; scroll text window in horizontal direction
  690. ;; by #<integer> characters
  691. (txt-movehorizontal <txt> <integer>)
  692.  
  693. ;; return number of visible lines in text window
  694. (txt-visiblelinecount <txt>)
  695.  
  696. ;; return number of visible columns in text window
  697. (txt-visiblecolcount <txt>)
  698.  
  699. ;; text selection primitives
  700.  
  701. ;; returns #t if text is selection is made in the text buffer
  702. ;; #f otherwise 
  703. (txt-selectset <txt>)
  704.  
  705. ;; returns index of start of current selection
  706. (txt-selectstart <txt>)
  707.  
  708. ;; returns index of end of current selection  
  709. (txt-selectend)
  710.  
  711. ;; make a text selection from <integer1> to <integer2>
  712. (txt-setselect <txt> <integer1> <integer2>)
  713.               
  714. ;; returns next event for the text buffer
  715. (txt-get <txt>)
  716.  
  717. ;; number of pending events for the text buffer
  718. (txt-queue <txt>)         
  719.  
  720. ;; ungets an event (code: <integer>) for the text buffer
  721. (txt-unget <txt> <integer>)                             
  722.  
  723. ;; register an event handler (<expr>) for the text buffer
  724. (txt-eventhandler <txt> <expr>)
  725.  
  726. ;; init text edit module
  727. (txt-init)              
  728.  
  729. ;; return window handle of text buffer
  730. (txt-syshandle <txt>)
  731.  
  732. ;; set name of environment variable used for text buffer options
  733. (txtopt-set-name <string>)
  734.  
  735. ;; get name of environment variable used for text buffer options
  736. (txtopt-get-name)
  737.  
  738. ;; set a 'global' text selection from <integer1> to <integer2>
  739. (txtscrap-setselect <txt> <integer1> <integer2>)
  740.  
  741. ;; returns text buffer that owns current text selection
  742. (txtscrap-selectowner)
  743.                  
  744. ;; creates a new view on the text buffer
  745. (txtwin-new <txt>)
  746.  
  747. ;; number of views on the text buffer
  748. (txtwin-number)         
  749.  
  750. ;; closes a view on a text buffer
  751. (txtwin-dispose <txt>)
  752.  
  753. ;; set current view of the text buffer
  754. (txtwin-setcurrentwindow <txt>)
  755.  
  756. ;; start visual delay (hour glass)
  757. (visdelay-begin)                   
  758.  
  759. ;; set percent completed for hour glass
  760. (visdelay-percent <integer>)
  761.  
  762. ;; beende visual delay (hour glass)
  763. (visdelay-end)
  764.  
  765. ;; init visual delay 
  766. (visdelay-init)            
  767.  
  768. ;; send unkown key event back to wimp for further actions  
  769. (wimp-processkey <integer>)
  770.  
  771. ;; increment active windows counter
  772. (win-activeinc)
  773.  
  774. ;; decrement active windows counter
  775. (win-activedec)                    
  776.  
  777. ;; returns number of active windows
  778. (win-activeno)
  779.  
  780. ;; give caret away to window on the top of the window stack
  781. (win-give-away-caret)
  782.  
  783. ;; returns name and type of file to import as a list
  784. ;; or #f, if it fails
  785. (xferrecv-checkinsert)
  786.  
  787. ;; data (file) import completed
  788. (xferrecv-insertfileok)
  789.                                                       
  790. ;; tests if menu entry <integer> has been selected 
  791. ;; menu selection 'string': <symbol>
  792. (menu-item <symbol> <integer>)
  793.  
  794. ;; return submenu selection from menu selection
  795. ;; menu selection 'string': <symbol>
  796. (menu-subitem <symbol>)
  797.  
  798. ;;; predicates for decoding keyboard events
  799. ;;; for textedit windows
  800.  
  801. (txt-key-char? <integer>)     ; ascii char (0-255)
  802. (txt-key-special? <integer>)  ; special key, like function keys (265-512)
  803. (txt-key-return? <integer>)   ; return key
  804.  
  805. ;; arrow (cursor) key combinations
  806. (txt-key-up? <integer>)       
  807. (txt-key-down? <integer>)
  808. (txt-key-left? <integer>)
  809. (txt-key-right? <integer>)
  810. (txt-key-shift-up? <integer>)
  811. (txt-key-shift-down? <integer>)
  812. (txt-key-shift-left? <integer>)
  813. (txt-key-shift-right? <integer>)
  814. (txt-key-ctrl-up? <integer>)
  815. (txt-key-ctrl-down? <integer>)
  816. (txt-key-ctrl-left? <integer>)
  817. (txt-key-ctrl-right? <integer>)
  818.  
  819. ;; function key combinations
  820. ;; returns key number (1-12) or #f
  821. (txt-key-functionkey? <integer>)
  822. (txt-key-shift-functionkey? <integer>)
  823. (txt-key-ctrl-functionkey? <integer>)
  824. (txt-key-escape? <integer>)               ; escape key
  825.  
  826. ;; tab key combinations            
  827. (txt-key-tab? <integer>)                  
  828. (txt-key-shift-tab? <integer>)
  829. (txt-key-ctrl-tab? <integer>)
  830.  
  831. ;; print key combinations
  832. (txt-key-print? <integer>)                
  833. (txt-key-shift-print? <integer>)
  834. (txt-key-ctrl-print? <integer>)
  835.  
  836. ;; insert key combinations
  837. (txt-key-insert? <integer>)
  838. (txt-key-shift-insert? <integer>)
  839. (txt-key-ctrl-insert? <integer>)
  840. (txt-key-delete? <integer>)          ; delete key
  841. (txt-key-backspace? <integer>)       ; backspace key
  842.  
  843. ;; copy key combinations
  844. (txt-key-copy? <integer>)
  845. (txt-key-shift-copy? <integer>)
  846. (txt-key-ctrl-copy? <integer>)
  847. (txt-key-home? <integer>)            ; home key
  848. (txt-key-pageup? <integer>)          ; pageup key
  849. (txt-key-pagedown? <integer>)        ; pagedown key
  850.  
  851. ;;; mouse events
  852. ;; clicked on window close icon
  853. (txt-closeicon? <integer>)         
  854.    
  855. ;; events for vertical scroll bar    
  856. (txt-scrollarrow-up? <integer>)      ; scroll arrow up pressed
  857. (txt-scrollarrow-down? <integer>)    ; scroll arrow down pressed
  858. (txt-scrollbar-up? <integer>)        
  859. (txt-scrollbar-down? <integer>)
  860.  
  861. ;; mouse events in the text window
  862. ;; returns position in text buffer where event occured or #f
  863. (txt-select-clicked? <integer>)         
  864. (txt-select-doubleclicked? <integer>)   
  865. (txt-adjust-clicked? <integer>)         
  866. (txt-adjust-doubleclicked? <integer>)   
  867. (txt-select-pressed? <integer>)
  868. (txt-adjust-pressed? <integer>)
  869. (txt-icon-dragged? <integer>)      ; icon dragged over window
  870. (txt-mouse-event? <integer>)       ; is it a mouse event ?
  871. (txt-mouse-position <integer>)     ; returns position of a mouse event
  872.                                         
  873. ;; insert string to the left of the cursor
  874. (txt-insertstring* <txt> <expr-sequence>)
  875.  
  876. ;; insert char to the left of the cursor
  877. (txt-insertchar* <txt> <char>)
  878.  
  879. ;; delete <integer> characters to the left of the cursor
  880. (txt-delete* <txt> <integer>)
  881.  
  882. ;; return current selection as a string
  883. (txt-getselection <txt>)
  884.  
  885. ;;; primitives for the lisp identation
  886. ;; calculate lisp identation level
  887. ;; returns identation level
  888. (txt-lisp-calcident <txt>)
  889.  
  890. ;; is char at index <integer> within a lisp comment ?
  891. (txt-lisp-comment? <txt> <integer>)
  892.  
  893. ;; is char a whitespace character ? 
  894. (txt-lisp-whitespace? <char>)                                
  895.  
  896. ;; is char at index <integer> a valid lisp parenthesis
  897. (txt-lisp-paren? <txt> <integer>)
  898.  
  899. ;; is char at index <integer> within a string constant ?
  900. (txt-lisp-string? <txt> <integer>)  
  901.  
  902. ;; is char at index within a character constant ?
  903. (txt-lisp-charconst? <txt> <integer>)
  904.  
  905. ;; return index of matching parenthesis or #f 
  906. (txt-lisp-matchparen <txt> <integer>)
  907.  
  908. ;; return index of next valid lisp paren or #f
  909. (txt-lisp-nextparen <txt> <:forward/:backward> < #\( / #\) >)
  910.  
  911. ;; insert newline to the left of the cursor
  912. (txt-newline <txt>)              
  913.  
  914. ;; insert integer spaces to the left of the cursor
  915. (txt-insertspaces <txt> <integer>)
  916.  
  917. ;; calculate identation level of current line
  918. (txt-identlevel <txt>)   
  919.       
  920. ;; is line an empty line ?
  921. (txt-emptyline? <txt> [integer])
  922.  
  923. ;; return line number of current line
  924. (txt-linenumber <txt> [integer])
  925.  
  926. ;; return index of end of line
  927. (txt-end-of-line <txt> [integer])
  928.  
  929. ;; return index of beginning of line
  930. (txt-begin-of-line <txt> [integer])
  931.  
  932. ;; search text buffer in forward direction (<bool> case sensitiv)
  933. (txt-findforward <txt> <string> <bool>)
  934.  
  935. ;; search text buffer in backward direction (<bool> case sensitiv)
  936. (txt-findbackward <txt> <string> <bool>) 
  937.  
  938. ;; load file with name <string> into text buffer from index <integer> on
  939. ;; [bool] display hourglass during loading
  940. (txt-load <txt> <string> <integer> [bool])
  941.  
  942. ;; save contents of buffer with given filename <string> form
  943. ;; index <integer1> to index <integer2>
  944. ;; [bool] display hourglass during saving
  945. (txt-save <txt> <string> <integer1> <integer2> [bool])
  946.  
  947. ;; save text buffer with a save box with default name <string> from
  948. ;; index <integer1> to index <integer2>
  949. ;; [bool] display hourglass during saving
  950. (txt-saveas <txt> <string> <integer1> <integer2> [bool])
  951.  
  952. ;; print text buffer from index <integer1> to index <integer2>
  953. ;; to the current printer 
  954. ;; [bool] displat hourglass during saving
  955. (txt-print <txt> <integer1> <integer2> [bool])
  956.  
  957. ;; undo last action
  958. (txt-undo <txt>)   
  959.  
  960. ;; redo last undone action
  961. (txt-redo <txt>)          
  962.  
  963.  
  964.  
  965.